package demo.yangxu.springcloud.alibaba.controller;

import demo.yangxu.springcloud.alibaba.domain.CommonResult;
import demo.yangxu.springcloud.alibaba.domain.Order;
import demo.yangxu.springcloud.alibaba.service.OrderService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class OrderController {

    @Resource
    private OrderService orderService;

//    @GetMapping("/order/create")
//    public CommonResult create(Order order)
//    {
//        orderService.create(order);
//        return new CommonResult(200,"订单创建成功");
//    }

    @GetMapping("/order/create")
    public CommonResult<Order> create(Order order)
    {
        orderService.create(order);
        return new CommonResult<Order>(200,"订单创建成功",order);
    }


}
